


#define _SWAPCreateStream(x)  x = CreateStream([](unsigned int size)->_fstr{return (_fstr)_Malloc(size);})
  //  static _fstr SWAProot = NULL;
  //  static _fstr IFDSWAProot = NULL;
  // volatile _length SWAPbegin;
  //Basic on the IFD Service
  int SWAP_INIT()
  {//Run at the Parent process started
    //Create PCB
    _pcb* pro = nullptr;
    //Check to the new-created pcb
      
    //Create Kernel Tree
    SWAProot = CreateStream([](unsigned int size)->_fstr{return (_fstr)Kmalloc(&kmemory,size);});
    DelegateStream(SWAProot,pro,&SwapOpe);
  }
  
namespace SWAP
{  
  
  const static _dsope(_fstr) SwapOpe=
  {
    SwapConvertToPub,SwapConvertToPrv,0,0,0,0,0,0
  };
  
  
}
/*
  Don't forget: Stream--PubStream is not belonged to any process, so its offset will be changed. 
*/

static _ptlong SwapConvertToPub(_fstr stream, _dfps streamto,_length num,_length offset)
{
  //  ConvertToPub(SWAP::IFDSWAProot,streamto,)
  if(_IS_DFPS_MEM(_GetAddress(offset)))
    _GetProcess(offset) = 0;

  return ReadFromSwap(streamto,offset);
}
 
static _ptlong SwapConvertToPrv(_dfps stream,_fstr streamto,_length num,_length offset)
{
  if(_IS_DFPS_MEM(_GetAddress(offset)))
    _GetProcess(offset) = 0;

  return WriteToSwap(stream,offset);
}

